package org.wenhua.yuan.and.cmbc

import android.annotation.SuppressLint
import android.content.Context
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.rishabhharit.roundedimageview.RoundedImageView
import com.rishabhharit.roundedimageview.RoundedImageView.Companion.ALL_ROUNDED_CORNERS_VALUE
import org.wenhua.androidaar.JHDisplayUtils
import org.wenhua.yuan.R
import org.wenhua.yuan.uilib.UIDataItem

class CMBCBannerAreaItem (data: List<CMBCDataMiddleBannerArea>, val context: Context) : UIDataItem<List<CMBCDataMiddleBannerArea>, RecyclerView.ViewHolder>() {
    override fun onBindViewHolderInChild(position: Int, viewHolder: RecyclerView.ViewHolder) {

    }


    @SuppressLint("ResourceAsColor")
    override fun getItemView(parent: ViewGroup): View? {
        val imageView:RoundedImageView = RoundedImageView(context)
        imageView.scaleType = ImageView.ScaleType.FIT_XY
        imageView.setCornerRadius(JHDisplayUtils.dp2px(18f))
        imageView.setRoundedCorners(ALL_ROUNDED_CORNERS_VALUE)
        imageView.setImageDrawable(context.resources.getDrawable(R.mipmap.adv1))
        val imageParam = FrameLayout.LayoutParams(JHDisplayUtils.getDisplayWidthInPx(context) - JHDisplayUtils.dp2px(25f), JHDisplayUtils.dp2px(100f))
        imageParam.topMargin = JHDisplayUtils.dp2px(2f)
        imageParam.leftMargin = JHDisplayUtils.dp2px(12.5f)
        imageView.layoutParams = imageParam
        return imageView
    }

}